<template>
  <div class="hello">
    <audio ref="player" :src="music" ></audio>
  </div>
</template>

<script>
import {mapGetters } from 'vuex';
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  computed:{
    ...mapGetters(['isPlay', 'music'])
  },
  watch:{
    isPlay(){
      console.log('change');
      if(this.isPlay){
        this.$refs.player.play();
      }else{
        this.$refs.player.pause();
      }
    },
    music(){
      console.log('music change')

    }
  }
}
</script>
